import ajax from './ajax'

const URL_BASE = '/api';
// [1、根据经纬度获取位置详情]

export const reqAddress = (geohash) => ajax(`${URL_BASE}/position/${geohash.latitude},${geohash.longitude}`);
// [2、获取食品分类列表]
export const reqShopTypes = () => ajax(URL_BASE + '/index_category')
// [3、根据经纬度获取商铺列表]
export const reqShops = (latitude, longitude) => ajax(URL_BASE + `/shops`, {
  latitude,
  longitude
})
// [4、根据关键字搜索商铺列表]
export const reqKeyword = ({
  keyword
}) => ajax(URL_BASE + '/search_shops', {
  keyword
})
// [5、获取一次性验证码]
export const reqCode = () => ajax(URL_BASE + '/captcha')
// [6、用户名密码登陆]
export const reqNameLogin = ({
  name,
  pwd,
  captcha
}) => ajax(URL_BASE + '/login_pwd', {
  name,
  pwd,
  captcha
}, 'POST')
// [7、发送短信验证码]
export const reqSMS = (phone) => ajax(URL_BASE + '/sendcode', {
  phone
})
// [8、手机号验证码登陆]
export const reqPhoneSMS = ({
  phone,
  code
}) => ajax(URL_BASE + '/login_sms', {
  phone,
  code
}, 'POST')
// [9、根据会话获取用户信息]
export const reqUserInfo = () => ajax(URL_BASE + '/userinfo')
// [10、用户登出]
export const reqLogout = () => ajax(URL_BASE + '/logout')
// 获取商家信息
export const reqInfo = () => ajax('/info')
// 获取商品评论列表
export const reqRatings = () => ajax('/ratings')
// 获取商品信息
export const reqFoods = () => ajax('/foods')